The present invention relates generally to an improved data processing system and in particular to a method and apparatus for processing a data stream. Still more particularly, the present invention provides a method and apparatus for reducing the size of a data stream.
Currently, metadata streams are created in the order that applications call graphical functions. Metadata is data about data. For example, the title, subject, author, and size of a file constitute metadata about a file. With respect to graphics, the current position, color, and size of a primitive, such as a box, constitute the metadata for the box. Currently, the application is relied on to optimize graphical functions. With object oriented computing environments, the metadata streams become saturated with repetitive and redundant attribute setting calls. This saturation occurs because objects within the object oriented computing environments may generate attribute setting calls without any knowledge of what other setting calls that other objects are making. Many constructors, the initial method of an object, initialize a set of attributes regardless of which graphical primitives are called and which attributes are actually needed. The attributes are set back to defaults, which generally happens for destructors, terminating objects. In many types of applications, such as spreadsheets, graphical applications, image applications, and front ends to databases, generic attribute mapping is used from the application layer. This generic attribute mapping from the application layer causes several attribute types to be affected even with only one attribute type being used in subsequent primitive calls. In addition, many applications set multiple attributes several times even back to the default value before they are ever used by a primitive call. As a result, the overhead in a metadata stream increases with the generic attribute mapping and the repeated changing of attributes prior to use in a primitive call.
Therefore, it would be advantageous to have an improved method and apparatus for managing a graphics data stream.
The present invention provides a method and apparatus in a data processing system for generating a metadata stream. An attribute call is received to set an attribute. In response, a first database is queried to determine whether the attribute call is present in the first database. The first database is updated in response to the attribute call being absent or different in the first database. In response to receiving a primitive call, an attribute call associated with the primitive is retrieved from the first database. A determination is made as to whether the attribute associated with the primitive is present in a second database. The second database is updated to include the attribute associated with the primitive call in response to the attribute associated with the primitive call being absent or different in the second database. The attribute call associated with the primitive call and the primitive call is placed in the metadata stream.